<!DOCTYPE html>
<html>
<head>
  <title><%= "#{@project.name} - " if @project %><%= t('fulcrum') %></title>
  <%= csrf_meta_tag %>
  <%= stylesheet_link_tag :application %>
  <%= javascript_include_tag :application %>
  <%= javascript_tag do %>
    I18n.defaultLocale = "<%= I18n.default_locale %>";
    I18n.locale = "<%= I18n.locale %>";
  <%- end -%>
</head>
<body>

<div id="header">
  <ul id="primary-nav">
    <li class="root"><%= link_to t('fulcrum'), root_path %></li>
    <% if current_user %>
      <li<%= ' class="secondary"'.html_safe if current_user.projects.present? %>>
        <%= link_to Project.model_name.human(:count => 2), root_path %>
        <%- if current_user.projects.present? -%>
          <ul>
            <%- current_user.projects.each do |project| -%>
              <li><%= link_to project, project %></li>
            <%- end -%>
          </ul>
        <%- end %>
      </li>
      <li><%= link_to current_user.email, edit_user_registration_path %></li>
      <li><%= link_to t('log out'), destroy_user_session_path,
                      :method => :delete %></li>
    <% else %>
      <li><%= link_to t('log in'), new_user_session_path %></li>
      <%- unless Fulcrum::Application.config.fulcrum.disable_registration %>
      <li><%= link_to t('sign up'), new_user_registration_path %></li>
      <% end -%>
    <% end %>
  </ul>
</div>

<div id="title_bar">
  <%= yield :title_bar %>
</div>

<div id="main">
  <%= show_messages %>

  <%= yield %>
</div>

</body>
</html>

